package cn.hnucm.searchesservice.service.impl;

import cn.hnucm.searchesservice.dao.TbLogDao;
import cn.hnucm.searchesservice.entity.TbLog;
import cn.hnucm.searchesservice.service.TbLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统日志 服务实现类
 * </p>
 *
 * @author chenjintao
 * @since 2021-12-20
 */
@Service
public class TbLogServiceImpl implements TbLogService {

    @Autowired
    @Qualifier("tbLogDaoImpl")
    private TbLogDao dao;

    /**
     * 获取所有的日志
     * @return
     */
    @Override
    public List<TbLog> getAllLog() {
        return dao.getAllLog();
    }

    /**
     * 增加一条日志
     * @param tbLog
     * @return
     */
    @Override
    public Boolean addLog(TbLog tbLog) {
        return dao.addLog(tbLog);
    }

    /**
     * 通过日志Id删除一条日志
     * @param logId
     * @return
     */
    @Override
    public Boolean deleteLogById(Integer logId) {
        return dao.deleteLogById(logId);
    }

    /**
     * 通过日志Id查询一条日志
     * @param logId
     * @return
     */
    @Override
    public TbLog selectLogById(Integer logId) {
        return dao.selectLogById(logId);
    }

    /**
     * 批量查询日志,根据多层因素
     * @param userId
     * @param operation
     * @param method
     * @param pageFrom
     * @param pageSize
     * @return
     */
    @Override
    public List<TbLog> selectLog(Integer userId, String operation, String method,
                                  Integer pageFrom, Integer pageSize){
        return dao.selectLog(userId,operation,method,pageFrom,pageSize);
    }
}
